﻿namespace Pap.Web.MasterPages
{
    using System;
    using Coolite.Ext.Web;
    using Pap.Web.Utils;

    /// <summary>
    /// 
    /// </summary>
    public partial class Report : System.Web.UI.MasterPage
    {
        #region Events

        ///// <summary>
        ///// Occurs when [export report].
        ///// </summary>
        //public event EventHandler<EventArgs> ExportReport;

        /// <summary>
        /// Occurs when Generate Report.
        /// </summary>
        public event EventHandler<EventArgs> GenerateReport
        {
            add
            {
                this.Events.AddHandler("GenerateReport", value);
            }
            remove
            {
                this.Events.RemoveHandler("GenerateReport", value);
            }
        }

        ///// <summary>
        ///// Occurs when [refresh report].
        ///// </summary>
        //public event EventHandler<EventArgs> RefreshReport;

        #endregion Events

        #region Events

        protected void uxBtnGenerate_Click(object sender, AjaxEventArgs args)
        {
            var dlgt = this.Events["GenerateReport"] as EventHandler<EventArgs>;
            if (dlgt != null)
                dlgt(this, args);
        }

        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.uxMainPanel.Title = Page.Title;
        }

        /// <summary>
        /// Handles the Clicked event of the btnBack control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">The <see cref="Coolite.Ext.Web.AjaxEventArgs"/> instance containing the event data.</param>
        protected void btnBack_Clicked(object sender, EventArgs e)
        {
            this.RedirectToPreviousPage();
        }

        #endregion
    }
}